package icasue.tools.sqlhelper.core.providers;

import icasue.reflect.annotations.NotNull;
import icasue.tools.sqlhelper.core.SaveMode;

import java.util.List;

/**
 * @Author: Qiao Hang
 * @CreateDate: 2021/9/26 下午5:24
 * @UpdateDate:
 * @Description:
 */
public interface SaveSqlProvider<JavaType extends Object> {
    /**
     * 单记录保存，保存所有列.
     * @param inst
     * @return
     * @throws Throwable
     */
    String save(@NotNull JavaType inst, @NotNull SaveMode saveMode) throws Throwable;


    /**
     * 多记录保存，保存所有列.
     * @param instMulti
     * @return
     * @throws Throwable
     */
    String saveMulti(@NotNull List<JavaType> instMulti, @NotNull SaveMode saveMode) throws Throwable;

    /**
     * 单记录保存，保存不为null的列.
     * @param inst
     * @return
     * @throws Throwable
     */
    String saveSmart(@NotNull JavaType inst, @NotNull SaveMode saveMode) throws Throwable;


    /**
     * 多记录保存，保存不为null的列.
     * @param instMulti
     * @return
     * @throws Throwable
     */
    String saveSmartMulti(@NotNull List<JavaType> instMulti, @NotNull SaveMode saveMode) throws Throwable;
}
